home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Loadstar 2
/
002.d81
/
crypto helper
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-08-26
|
6KB
|
245 lines
10 poke53272,21:poke783,peek(783)and254
20 poke53280,3:poke53281,1:printchr$(156):poke53272,21
30 printchr$(147):poke781,5:poke782,12:sys65520:print"cryptogram helper"
40 poke781,8:poke782,19:sys65520:print"by"
50 poke781,11:poke782,14:sys65520:print"russ gephart"
60 poke781,19:poke782,6:sys65520:print"translated by donna k. woody"
70 poke781,23:poke782,7:sys65520:print"press space bar to continue";:
80 poke198,0:wait198,1:geta$
90 printchr$(147):print"do you need instructions (y/n)?[160]";:
100 poke198,0:wait198,1:geta$
110 ifa$="y"thengosub6500:goto1010
120 ifa$="n"then1010
130 goto90
1000 rem cryptogram program by russ gephart
1010 dimsc(26),st(26)
1020 printchr$(147):x=0
1025 v=22:sp$=" "
1030 printchr$(156):print:print"enter encrypted line (cr) to end"
1040 inputa$(x)
1050 ifa$(x)=""then1070
1060 x=x+1:ifx<>7then1030
1070 printchr$(147):printchr$(156)
1080 forz=0tox-1
1090 poke781,z*3+2:poke782,1:sys65520:printa$(z)
1100 nextz
1110 poke781,24:poke782,24:sys65520:print"* for submenu";
1113 poke781,v:poke782,0:sys65520
1115 printchr$(144);:print"substitute ? with ?[157][157][157][157][157][157][157][157]";:poke198,0:wait198,1:getb$
1120 ifasc(b$)=42then2000:rem *
1130 ifasc(b$)=13then1195:rem c/r
1140 printb$;spc(6):poke198,0:wait198,1:getc$
1150 ifasc(c$)=42then2000:rem *
1160 ifasc(c$)=13then1195:rem c/r
1170 printc$
1180 gosub1230:rem search & sub
1195 gosub1220
1200 goto1110
1210 rem clear bottom lines
1220 poke781,v:poke782,0:sys65520:printsp$:printsp$:printsp$;:return
1230 rem search & replace
1240 forz=0tox-1
1250 forzz=1tolen(a$(z))
1260 ifmid$(a$(z),zz,1)=b$thengosub1300
1270 nextzz
1280 nextz
1290 return
1300 poke781,z*3+1:poke782,zz:sys65520
1310 ifc$=" "thenprintc$:return
1320 printchr$(159);c$;chr$(144):return
1999 :
2000 rem escape routines
2001 :
2010 gosub1210
2020 poke781,v:poke782,0:sys65520:print"*=clear e=edit f=letter frequency"
2030 print"s=save l=load r=restart"
2035 print"h=help x=exit";:poke198,0:wait198,1:geta$
2040 ifasc(a$)=42then2500
2050 ifa$="e"then3000
2060 ifa$="f"then3500
2070 ifa$="s"then4000
2080 ifa$="l"then4500
2090 ifa$="r"then5000
2095 ifa$="h"thengosub6500:goto1080
2100 ifa$="x"then5500
2110 goto1195
2499 :
2500 rem clear screen routine
2501 :
2505 printchr$(19)
2510 forz=0tox-1
2520 poke781,z*3+2:poke782,1:forc=1tolen(a$(z))+1:print" ";:nextc
2530 print:print:print:nextz
2540 goto1195
2999 :
3000 rem edit routine
3001 :
3010 gosub1220
3020 poke781,v:poke782,0:sys65520:print"which line to re-enter";
3025 poke198,0:wait198,1:geta$
3027 a=val(a$):ifa>zora<1goto3020
3030 poke781,(a-1)*3+3:poke782,0:sys65520
3040 inputa$(a-1)
3050 gosub1210
3060 f=0
3070 goto1070
3499 :
3500 rem frequency routine
3501 :
3510 gosub1210
3520 iff=1then3740
3530 forcc=1to26:sc(cc)=0:next
3540 poke781,v:poke782,0:sys65520:print"counting letters";:
3550 forz=0tox-1
3560 forzz=1tolen(a$(z))
3570 j$=mid$(a$(z),zz,1)
3580 ifasc(j$)>=65andasc(j$)<=90thensc(asc(j$)-64)=sc(asc(j$)-64)+1
3590 nextzz
3600 nextz
3610 rem sort routine
3620 gosub1210:poke781,22:poke782,0:sys65520:print"sorting by frequency":
3630 fory=1to26:st(y)=y:next
3640 fory=1to25
3650 gosub3680
3660 nexty
3670 goto3740
3680 ifsc(y)>=sc(y+1)thenreturn
3690 j=sc(y):sc(y)=sc(y+1):sc(y+1)=j
3700 j=st(y):st(y)=st(y+1):st(y+1)=j
3710 ify=1thenreturn
3720 y=y-1
3730 goto3680
3740 gosub1210
3745 poke781,v:poke782,0:sys65520:h=0:flag=0
3750 fory=1to26
3755 ifflag>36thenv=v+1:flag=0:h=0:poke781,v:poke782,h:sys65520
3760 ifsc(y)=0then3790
3765 st$=mid$(str$(sc(y)),2)
3770 printchr$(st(y)+64);st$" ";:flag=flag+3-(sc(y)>9)
3780 nexty
3790 poke198,0:wait198,1:geta$
3800 f=1
3810 v=22:goto1195
3999 :
4000 rem save routine
4001 :
4010 gosub1220
4020 poke781,v:poke782,0:sys65520:print"save file?[160](y/n) "
4025 poke198,0:wait198,1:geta$
4030 ifa$<>"y"then1195
4040 gosub1220
4050 poke781,v:poke782,0:sys65520:input"name of file to save ";f$
4060 iff$=""then1195
4070 gosub1220
4080 poke781,v:poke782,0:sys65520:print"now saving ";f$
4090 open15,8,15,"r0:"+f$+"="+f$:gosub6000
4100 ifcz>20andcz<>62andcz<>63then4200
4110 ifcz=62then:open4,8,4,"0:"+f$+",seq,w":goto4155
4120 print"file already exists. continue (y/n)";
4130 poke198,0:wait198,1:geta$
4140 ifa$<>"y"thenclose4:close15:goto1195
4150 print#15,"s0:"+f$:open4,8,4,"0:"+f$+",seq,w"
4155 forz=0tox-1
4160 print#4,a$(z)
4165 next
4170 close4:close15
4180 goto1195
4200 print"there is a disk error #"cz"which is":printmz$
4210 print"continue (y/n)?[160]";:poke198,0:wait198,1:geta$
4220 ifa$<>"y"then1195
4230 goto4010
4499 :
4500 rem load routine
4501 :
4510 gosub1220
4520 poke781,v:poke782,0:sys65520:print"load file? (y/n) ";
4525 poke198,0:wait198,1:geta$
4530 ifa$<>"y"then1195
4540 gosub1220
4550 poke781,v:poke782,0:sys65520:input"name of file to load ";f$
4560 iff$=""then1195
4570 gosub1220
4580 poke781,v:poke782,0:sys65520:print"now loading ";f$:ff=0
4590 open15,8,15:open4,8,4,"0:"+f$+",seq,r":gosub6000
4600 ifcz>20andcz<>62andcz<>63then4680
4610 ifcz=62thengoto4630
4620 goto4655
4625 gosub1220:poke781,v:poke782,0:sys65520
4630 print"file not found on this disk. do you"
4635 print"want to continue (y/n)?[160]";:poke198,0:wait198,1:geta$
4640 ifa$<>"y"thenclose4:close15:goto1195
4645 close4:close15:goto4510
4655 z=0
4660 input#4,a$(z)
4665 ifst=64then4670
4667 z=z+1:goto4660
4670 close4:close15:x=z+1
4675 goto1070
4680 gosub1220:poke781,v:poke782,0:sys65520:print"there is a disk error #"
4682 printcz" which is"
4685 printmz$tab(len(mz$)+2)"continue (y/n)?[160]";:poke198,0:wait198,1:geta$
4690 ifa$<>"y"then1195
4695 goto4510
4999 :
5000 rem restart program
5001 :
5010 clr:goto1010
5500 rem exit program
5510 printchr$(147)
5520 print"[147]load"chr$(34)"payload"chr$(34)",8":print"run"
5530 poke631,13:poke632,13:poke198,2
5540 end
5997 :
5998 rem dos error check
5999 :
6000 input#15,cz,mz$,tz,sz:return
6497 :
6498 rem instructions
6499 :
6500 printchr$(147):poke53272,23:printchr$(156)
6510 print" [215]elcome to [195][210][217][208][212][207][199][210][193][205] [200][197][204][208][197][210]":print:print
6520 print" [215]ith this program, you'll be able to":print
6530 print"solve cryptogram puzzles without":print
6540 print"wearing a hole in the paper!":print
6550 print" [217]ou have the option of entering up to":print
6560 print"7 lines of coded text. [212]hen you can":print
6570 print"substitute one letter for another until":print
6580 print"you solve the puzzle."
6590 poke781,23:poke782,0:sys65520:print"[208][210][197][211][211][160][211][208][193][195][197][160][194][193][210][160][212][207][160][195][207][206][212][201][206][213][197]";:
6595 poke198,0:wait198,1:geta$
6600 printchr$(147):print" [193] '*' entered when you are asked":print
6610 print"for a letter, will give you a sub-menu.":print
6620 print"[200]ere are the options you will have:":print
6630 print" * = [195][204][197][193][210] all gusses from the"
6640 print" screen, but leave the text":print
6650 print" [197] =[160][197][196][201][212] a line of text you have"
6660 print" entered (correct any typos"
6670 print" with this function)":print
6680 print" [198][160]=[160][204][197][212][212][197][210][160][198][210][197][209][213][197][206][195][217] will tell you"
6690 print" how many times each letter of"
6700 print" the encrypted text appears."
6710 print" [212]he first time this is used,"
6720 print" it takes a while, so be"
6725 print" patient."
6770 poke781,23:poke782,0:sys65520:print"[208][210][197][211][211][160][211][208][193][195][197][160][194][193][210][160][212][207][160][195][207][206][212][201][206][213][197]";:
6775 poke198,0:wait198,1:geta$
6776 printchr$(147)
6780 print" [211][160]=[160][211][193][214][197] encrypted text so you can"
6790 print" work on it later. [212]he 64 will"
6800 print" check to see if the file"
6810 print" already exists on disk.":print
6820 print" [204][160]= [204][207][193][196] a file from disk.":print
6830 print" [210][160]= [210][197][211][212][193][210][212] the program. [217]ou will"
6840 print" be able to enter new text."
685